package com.billing.web.controller.common;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.el.ELException;
import javax.servlet.jsp.el.ExpressionEvaluator;

public class JspUtils {
	public static Object eval(String expr, Class type, JspContext jspContext)
			throws JspException {
		try {
			if (expr.indexOf("${") == -1)
				return expr;
			ExpressionEvaluator evaluator = jspContext.getExpressionEvaluator();
			return evaluator.evaluate(expr, type, jspContext
					.getVariableResolver(), null);
		} catch (ELException e) {
			throw new JspException(e);
		}
	}
}